import { createRouter, createWebHistory } from 'vue-router';
import calculators from '../components/calculators.vue';
import programmerTools from '../components/programmerTools.vue';
import jsonFormat from '../components/programmerTools/jsonFormat.vue';
import base64 from '../components/programmerTools/base64.vue';
import unicode from '../components/programmerTools/unicode.vue';
import ascii from '../components/programmerTools/ascii.vue';
import uuid from '../components/programmerTools/uuid.vue';
import hash from '../components/programmerTools/hash.vue';
import timestamp from '../components/programmerTools/timestamp.vue';
import sri from '../components/programmerTools/sri.vue';

import individualIncomeTax from '../components/calculators/individualIncomeTax.vue';
import houseLoan from '../components/calculators/houseLoan.vue';

import error from '../components/error.vue';


const routes = [
    {
        name: 'programmerTools',
        path: '/programmerTools',
        component: programmerTools,
        children: [
            // {
            //     name: 'jsonFormat',
            //     path: 'jsonFormat',
            //     component: jsonFormat // TODO
            // },
            {
                name: 'base64',
                path: 'base64',
                component: base64
            },
            {
                name: 'unicode',
                path: 'unicode',
                component: unicode
            },
            {
                name: 'ascii',
                path: 'ascii',
                component: ascii
            },
            {
                name: 'uuid',
                path: 'uuid',
                component: uuid
            },
            {
                name: 'hash',
                path: 'hash',
                component: hash
            },
            {
                name: 'timestamp',
                path: 'timestamp',
                component: timestamp // TODO
            },
            {
                name: 'sri',
                path: 'sri',
                component: sri
            },
        ]
    },
    {
        name: 'calculators',
        path: '/calculators',
        component: calculators,
        children: [
            {
                name: 'individualIncomeTax',
                path: 'individualIncomeTax',
                component: individualIncomeTax
            },
            {
                name: 'houseLoan',
                path: 'houseLoan',
                component: houseLoan
            },
        ]
    },
    {
        path: '/*',
        component: error,
    }
]

// 3. 创建路由实例并传递 `routes` 配置
// 你可以在这里输入更多的配置，但我们在这里
// 暂时保持简单
const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHistory(),
    routes, // `routes: routes` 的缩写
})

export default router;
